﻿@model IEnumerable<HdipCricketClub.Models.Opponent>

@{
    ViewBag.Title = "Opponents:";
}

<h2>@ViewBag.Title</h2>

<p>
    @Html.ActionLink("Add an opponent", "Create")
</p>
<table>
    <tr>
        <th>
            Opponent:
        </th>
        <th>
            Address:
        </th>
        <th>
            Phone:
        </th>
        <th>
            Email:
        </th>
        <th>
            Contact Name:
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.club_name)
            @Html.DisplayFor(modelItem => item.team_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.address_1),
            @if(item.address_2 != null)
            {
                @Html.DisplayFor(modelItem => item.address_2)@:,
            }
            @Html.DisplayFor(modelItem => item.town_city),
            @Html.DisplayFor(modelItem => item.County1.name),
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.phone)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.contact_name)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.opponent_id }) |
            @Html.ActionLink("Details", "Details", new { id=item.opponent_id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.opponent_id })
        </td>
    </tr>
}

</table>
